package com.baizhi.utils.spring;

import org.junit.Test;
import org.springframework.util.ClassUtils;

public class ClassUtilsTest {

    /**
     * 判断当前应用是否加载了某个类
     * 应用场景：当某个类存在后，再做某些事情
     */
    @Test
    public void test1() {
        String className = "com.baizhi.Hello";
        /*try {
            // Class.forName(className);
            ClassUtilsTest.class.getClassLoader().loadClass(className);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }*/
        System.out.println(ClassUtils.isPresent(className, null));
        className = "com.baizhi.utils.guava.GuavaTest";
        System.out.println(ClassUtils.isPresent(className, null));
    }
}
